import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'common/index.dart';
import 'global.dart';
// import 'package:flutter_localizations/flutter_localizations.dart';

void main() async {
  await Global.init();

  SystemChrome.setPreferredOrientations([
    // 强制竖屏
    DeviceOrientation.portraitUp
  ]);
  runApp(const AnMoApp());
}

class AnMoApp extends StatefulWidget {
  const AnMoApp({Key? key}) : super(key: key);

  @override
  State<AnMoApp> createState() => _EConcurAppState();
}

class _EConcurAppState extends State<AnMoApp> {
  @override
  Widget build(BuildContext context) {
    // EasyLoading.instance
    //   ..maskType = EasyLoadingMaskType.black
    //   ..userInteractions = false;
    // EasyLoading.show();
    return ScreenUtilInit(
      designSize: const Size(585, 1266),
      builder: (context, widget) =>

          // RefreshConfiguration(
          //   headerBuilder: () => pullToRefreshHeader(),
          //   footerBuilder: () => pullToRefreshFooter(),
          //   hideFooterWhenNotFull: true,
          //   headerTriggerDistance: 80,
          //   maxOverScrollExtent: 100,
          //   footerTriggerDistance: 150,
          //   child:

          GetMaterialApp(
        title: '工程运维',
        theme: AppTheme.light,
        debugShowCheckedModeBanner: false,
        initialRoute: AppRoutes.INITIAL,
        getPages: AppPages.routes,
        // home: Obx(
        //     () => UserStore.to.hasToken ? ApplicationPage() : LoginPage()),
        // home: ApplicationPage(),
        // builder: EasyLoading.init(
        //   builder: (context, child) {
        //     //add this line
        //     return MediaQuery(
        //       //Setting font does not change with system font size
        //       data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
        //       child: child!,
        //     );
        //   },
        // ),
        builder: (context, child) {
          //add this line
          return MediaQuery(
            //Setting font does not change with system font size
            data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
            child: child!,
          );
        },
        defaultTransition: Transition.cupertino,
        // translations: TranslationService(),
        // navigatorObservers: [AppPages.observer],
        // localizationsDelegates: const [
        //   GlobalMaterialLocalizations.delegate,
        //   GlobalWidgetsLocalizations.delegate,
        //   GlobalCupertinoLocalizations.delegate,
        // ],
        // supportedLocales: const [
        //   Locale('en', 'US'),
        //   Locale('zh', 'CN'),
        // ], //ConfigStore.to.languages,
        // locale: const Locale('zh', 'CN'), // ConfigStore.to.locale,
        // fallbackLocale: const Locale('en', 'US'),
        enableLog: true,
        logWriterCallback: Logger.write,
        // ),
      ),
    );
  }
}
